#ifndef UTILS_H
#define UTILS_H
#include <string>
#include <vector>
using namespace std;

string strip_spaces(string&);
unsigned countInstances(string, char);

template<typename T> vector<T> subvector(vector<T> a, unsigned start, int stop=-1)
{
	vector<T> b;
	if(start >= a.size()) {
		return a;
	}
	if(stop == -1 || stop > (int)a.size()) {
		stop = a.size()-1;
	}
	for(int i=start;i<stop;i++) {
		b.push_back(a[i]);
	}
	return b;
}

template<typename T>
vector<T> vectorconcat(vector<T> a, vector<T> b)
{
	a.insert(a.end(),b.begin(),b.end());
	return a;
}

double strToDouble(string str, int base);

#endif
